﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BluePumpkin.Library.AppCode.Context;

namespace BluePumpkin.Library
{
    class FaqsAnswreManager
    {
        public void Add(FAQsAnswerClass faqsAnswer)
        {
            using (BdbContext DBContext = new BdbContext())
            {
                FAQsAnswerClass _faqAns = new FAQsAnswerClass
                {
                    QuestionId = faqsAnswer.QuestionId,
                    Answer = faqsAnswer.Answer
                };

                DBContext.FAQAnswer.Add(_faqAns);
                DBContext.SaveChanges();

            }
        }

        public void Update(FAQsAnswerClass faqsAnswer)
        {
            using (BdbContext DBContext = new BdbContext())
            {
                var _faqAns = DBContext.FAQAnswer.Single(x => x.Id == faqsAnswer.Id);

                _faqAns.Answer = faqsAnswer.Answer;
                DBContext.SaveChanges();
            }
        }
    }
}
